<template>
	<view class="result">
		<nav-bars bgColor="transparent"></nav-bars>
		<view class="imgBox">
			<image v-if="status" :src="`${baseImg}/static/adminShop/writeOff/writeOffSuccess.png`" mode=""></image>
			<image v-else :src="`${baseImg}/static/adminShop/writeOff/writeOffFail.png`" mode=""></image>
			<text>{{status?'核销成功':'核销失败'}}</text>
			<view class="msg" v-if="!status">失败原因：{{msg}}</view>
		</view>
		<view class="btnBox">
			<view class="item" v-if="status" @click="keepOnBtn">继续核销</view>
			<view class="item" :class="{'active':status}" @click="backHome">回到首页</view>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				baseImg:this.$static,
				status:true, //true成功，false失败
				msg:''
			}
		},
		onLoad(options) {
			if(options.type=='success'){
				this.status = true
			}else{
				this.status = false
				this.msg = options.msg
			}
		},
		methods:{
			// 继续核销
			keepOnBtn(){
				uni.reLaunch({
					url:'/pagesFour/activity/writeOff/index'
				})
			},
			
			// 回到首页
			backHome(){
				uni.reLaunch({
					url:'/pages/mall/newIndex/newIndex'
				})
			}
		}
	}
</script>

<style lang="scss">
	page{
		height: 100%;
	}
	.result{
		height: 100%;
		position: relative;
		.imgBox{
			display: flex;
			flex-direction: column;
			align-items: center;
			position: absolute;
			bottom: 50%;
			left: 50%;
			transform: translate(-50%,-10%);
			image{
				width: 172rpx;
				height: 172rpx;
				margin-bottom: 66rpx;
			}
			font: bold 42rpx/50rpx PingFang SC;
			color: #242424;
			.msg{
				margin-top: 30rpx;
				font: 500 24rpx/42rpx PingFang SC;
				color: #242424;
			}
		}
		.btnBox{
			position: fixed;
			width: 100%;
			bottom: 0;
			left: 0;			padding-bottom: constant(safe-area-inset-bottom);			padding-bottom: env(safe-area-inset-bottom);
			.item{
				width: 608rpx;
				height: 92rpx;
				margin: 20rpx auto;
				text-align: center;
				border-radius: 46rpx;
				font: bold 30rpx/92rpx PingFang SC;
				color: #fff;
				background: linear-gradient(32deg, #EBB964, #E2AD54);
			}
			.active{
				background: linear-gradient(32deg, rgba(235,185,100,.12), rgba(226,173,84,.12));
				color: #CB9436;
			}
		}
	}
</style>
